package com.simple.editor.ui;

import javax.swing.*;
import java.awt.*;

/**
 * Created with IntelliJ IDEA.
 * User: vsoroka
 * Date: 10.06.13
 * Time: 20:23
 * To change this template use File | Settings | File Templates.
 */
class Utils {

    private static final String FONT_NAME = "Verdana";

    public static void updateLabelForTheFile(final JLabel label, final FileModel file) {
        final Font font;
        if (file.isChanged()) {
            font = new Font(FONT_NAME, Font.BOLD, 12);
        } else {
            font = new Font(FONT_NAME, Font.PLAIN, 12);
        }
        label.setFont(font);
        switch (file.getStatus()) {
            case ADDED:
                label.setForeground(Color.green);
                break;
            case MODIFIED:
                label.setForeground(Color.blue);
                break;
            case CONFLICTED:
                label.setForeground(Color.red);
                break;
            case DELETED:
                label.setForeground(Color.lightGray);
                break;
            case IGNORED:
                label.setForeground(Color.gray);
                break;
            case REPLACED:
                label.setForeground(Color.cyan);
                break;
            case MISSING:
                label.setForeground(Color.red);
                break;
            case NOT_UNDER_CONTROL:
                label.setForeground(Color.black);
                break;
            case UNKNOWN:
                label.setForeground(Color.darkGray);
                break;
            default:
                label.setForeground(Color.darkGray);
                break;
        }
    }
}
